<?php
include 'input.php';
$connn = new mysqli('127.0.0.1','root','root','php');

if($connn->connect_errno != 0){
   
    echo "连接数据库失败";
    exit;
}

$connn->query("SET NAMES UTF8");
$sqls = "select * from news where 1 = 1";
$biaoti = $input->post('biaoti');
$content = $input->post('content');
if(isset($biaoti)){
    $sqls .= " and biaoti like '%{$biaoti}%' ";
}

if(isset($content)){
    $sqls .= " and content like '%{$content}%' ";
}
$res = $connn->query($sqls);
while($roww = $res->fetch_array(MYSQLI_ASSOC)){
    $rowws[] = $roww;
}

$count = count($rowws);
$pageSize = $count % 3 != 0 ? intval($count / 3) + 1 : $count / 3;
echo $count;
echo $pageSize;
echo $sqls;
//header("Location:index.php");
